using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace TVSGPP.chart
{
	public class frmPriceInChart : Form
	{
		public ArrayList listPrice;
		public ArrayList listTime;
		public ArrayList listDistance;
		public float minValue = 0f;
		public float maxValue = 0f;
		public float avgValue = 0f;
		private IContainer components = null;
		public frmPriceInChart()
		{
			this.InitializeComponent();
		}
		private void frmPriceInChart_Paint(object sender, PaintEventArgs e)
		{
			Graphics graphics = e.Graphics;
			graphics.DrawLine(new Pen(Brushes.Blue), new Point(50, 250), new Point(50, 10));
			graphics.DrawLine(new Pen(Brushes.Blue), new Point(50, 250), new Point(base.Width - 50, 250));
			graphics.DrawString("O", new Font("Arial", 8f), Brushes.Blue, 40f, 250f);
			graphics.DrawString("^", new Font("Arial", 11f), Brushes.Blue, 45f, 5f);
			graphics.DrawString("Giá", new Font("Arial", 8f), Brushes.Blue, 40f, -3f);
			graphics.DrawString(">", new Font("Arial", 9f), Brushes.Blue, (float)(base.Width - 55), 243f);
			graphics.DrawString("Thời gian", new Font("Arial", 9f), Brushes.Blue, (float)(base.Width - 100), 250f);
			try
			{
				for (int i = 0; i < this.listPrice.Count; i++)
				{
					float num = 220f - float.Parse(this.listPrice[i].ToString()) * 210f / this.maxValue;
					float num2 = float.Parse(this.listDistance[i].ToString()) * (float)(base.Width - 50) / float.Parse(this.listDistance[this.listDistance.Count - 1].ToString());
					graphics.DrawString(this.listPrice[i].ToString(), new Font("Arial", 7f), Brushes.Blue, 10f, num + 2f);
					graphics.DrawString("--", new Font("Arial", 9f), Brushes.Blue, 45f, num);
					graphics.DrawString("|", new Font("Arial", 9f), Brushes.Blue, num2, 242f);
					graphics.DrawString(this.listTime[i].ToString(), new Font("Arial", 7f), Brushes.Blue, num2 - 20f, 257f);
					if (i > 0)
					{
						graphics.DrawLine(new Pen(Brushes.Red), new Point(int.Parse(Math.Round((double)(float.Parse(this.listDistance[i - 1].ToString()) * (float)(base.Width - 50) / float.Parse(this.listDistance[this.listDistance.Count - 1].ToString())), 0).ToString()), int.Parse(Math.Round((double)(220f - float.Parse(this.listPrice[i - 1].ToString()) * 210f / this.maxValue), 0).ToString())), new Point(int.Parse(Math.Round((double)num2, 0).ToString()), int.Parse(Math.Round((double)num, 0).ToString())));
					}
				}
			}
			catch
			{
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			base.SuspendLayout();
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(800, 280);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			base.Name = "frmPriceInChart";
			base.StartPosition = FormStartPosition.Manual;
			this.Text = "Biểu đồ biến động giá";
			base.Paint += new PaintEventHandler(this.frmPriceInChart_Paint);
			base.ResumeLayout(false);
		}
	}
}
